Skip to main content
Version: 16.8.2

config_element

ConfigElement

class ConfigElement()

A Content Management Policy configuration element which has a name, and can have attributes, switches, and subelements.

__init__

def __init__(
name: str,
attributes: dict = {},
switches: list = [],
subelements: list = [],
default: Optional[str] = None,
default_switches: list = [],
config: dict = {},
switches_module: "glasswall.content_management.switches" = Switch)

__str__

def __str__()

__getattr__

def __getattr__(name)

__repr__

def __repr__()

Change string representation of object.

__lt__

def __lt__(other)

Used for sorting. Sort by "name" then "switches".

text

@property
def text()

String representation of XML.

get_switch_names

def get_switch_names()

Returns a sorted list of unique Switch.name values from self.switches.

remove_switch

def remove_switch(switch: Union[Switch, str])

Removes all Switch instances from self.switches that match arg "switch".

Arguments:

  • switch Union[Switch, str] - A Switch instance or str to match Switch.name.

Returns:

self

Raises:

  • glasswall.content_management.errors.switches.SwitchNotFound - The switch was not found.

add_switch

def add_switch(switch: Switch, replace: bool = True)

Adds a Switch instance to self.switches.

Arguments:

  • switch Switch - A Switch instance.
  • replace bool, optional - Default True. Deletes any pre-existing Switch with the same .name attribute in self.switches.

Returns:

self